package com.zyit.controller;

import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.payment.page.models.AlipayTradePagePayResponse;
import com.zyit.dto.AliPay;
import com.zyit.pojo.OrderInfo;
import com.zyit.pojo.PaymentInfo;
import com.zyit.service.OrderInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

@Tag(name = "订单管理")
@RestController
@RequestMapping("/orders")
public class OrderInfoController {

    @Autowired
    private OrderInfoService orderInfoService;

    @Operation(summary = "生成订单")
    @PostMapping
    public OrderInfo add(@RequestBody OrderInfo info){
        orderInfoService.addOrder(info);
        return orderInfoService.findById(info.getId());
    }
}
